package com.definity.toolkit.ui.widget;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;

import javax.swing.JTextArea;

import com.definity.toolkit.ui.Body;

public class TextArea extends JTextArea implements Widget<TextArea> {

	private static final long serialVersionUID = -4037494540028337381L;

	public TextArea() {
		
	}
	
	@Override
	public String id() {
		return getName();
	}

	@Override
	public TextArea id(String id) {
		setName(id);
		return this;
	}

	@Override
	public TextArea properties(Body<TextArea> body) {
		body.content(this);
		return this;
	}

	@Override
	public TextArea size(int width, int height) {
		setPreferredSize(new Dimension(width, height));
		return this;
	}
	
	public String text() {
		return getText();
	}
	
	public TextArea text(String text) {
		setText(text);
		return this;
	}
	
	public TextArea selectInterval(int start, int end) {
		select(start, end);
		return this;
	}

	public TextArea lineWrap(boolean wrap) {
		setLineWrap(wrap);
		return this;
	}

	public TextArea wrapStyleWord(boolean word) {
		setWrapStyleWord(word);
		return this;
	}

	@Override
	public Color background() {
		return getBackground();
	}

	@Override
	public TextArea background(Color background) {
		setBackground(background);
		return this;
	}

	@Override
	public Color foreground() {
		return getForeground();
	}

	@Override
	public TextArea foreground(Color foreground) {
		setForeground(foreground);
		return this;
	}

	@Override
	public Font font() {
		return getFont();
	}

	@Override
	public TextArea font(Font font) {
		setFont(font);
		return this;
	}

}
